package com.plugin.manage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.plugin.core.model.entity.ElderBeds;
import org.apache.ibatis.annotations.Select;

public interface ElderBedsMapper  extends BaseMapper<ElderBeds> {


    /**
     * 统计可用床位数量
     * 统计elder_room表中status=1（可用）的记录数
     *
     * @return 可用床位数量
     */
    @Select("SELECT COUNT(distinct(bed_number)) FROM elder_beds WHERE del = 0 AND bed_status = 1")
    Long countAvailableBeds();


    /**
     * 统计 床位总数量
     *
     * @return 床位总数量
     */
    @Select("SELECT COUNT(distinct(bed_number)) FROM elder_beds WHERE del = 0")
    Long countBeds();
}
